import { createApp } from 'vue'
import { createPinia } from 'pinia'
// 优化4: 按需引入Element Plus组件，减少包体积
import { ElButton, ElInput, ElCard, ElForm, ElFormItem, ElDialog, ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/el-button.css'
import 'element-plus/theme-chalk/el-input.css'
import 'element-plus/theme-chalk/el-card.css'
import 'element-plus/theme-chalk/el-form.css'
import 'element-plus/theme-chalk/el-form-item.css'
import 'element-plus/theme-chalk/el-dialog.css'
import 'element-plus/theme-chalk/el-message.css'

import App from './App.vue'
import router from './router'

// 导入全局样式
import '@/assets/styles/global.scss'

const app = createApp(App)

// 按需注册Element Plus组件
app.use(ElButton)
app.use(ElInput)
app.use(ElCard)
app.use(ElForm)
app.use(ElFormItem)
app.use(ElDialog)

// 全局配置ElMessage
app.config.globalProperties.$message = ElMessage

app.use(createPinia())
app.use(router)

app.mount('#app')